<?php 
class sExerciseModel extends Zend_Db_Table_Abstract{
    protected $_name='submit_exercises';
    protected $_primary='id';
    
    
   public function checkData($id_ex,$id_stu){ 
		$validator=  new Zend_Validate_Db_RecordExists(
                
                array(
																	'table'=>'submit_exercises',
																	'field'=>'id_exercises',
																	'exclude' => "id_students =".$id_stu
																	)
                
        );
		if($validator->isValid(trim($id_ex)))
			return true;
		else
			return false;
	}
    
    public function getDb($id_ex,$id_stu){
   	    $db = Zend_Registry::get('connectDB');
		$mysql = $db ->select()
					->from($this->_name)
					->where('id_exercises=?',$id_ex)
                    ->where('id_students=?',$id_stu);
		$result = $db->fetchAll($mysql);
        return $result;
    }
    
  
}
?>